<?php
class Pay_method_model extends CI_Model
{
    private $table = 'pay_method';
    
    public function findByParams($params=array())
    {
        $this->db->order_by('sort', 'ASC');
        return $this->db->get($this->table);
    }
    
    public function findById($id)
    {
        $this->db->where_in('method_id',$id);
        return $this->db->get($this->table);
    }
    

    public function findByBankId($pay_bank)
    {
        $this->db->where('bank_id', $pay_bank);
        $result = $this->db->get($this->table);
        return $result->row();
    }

    /**
     * 查找所有银行
     */
    public function findByShortcut($shortcut)
    {
        $this->db->select('method_id, method_name, bank_id, bank_name, bank_code, bank_img');
        $this->db->from($this->table);
        $this->db->where('shortcut', $shortcut);
        $this->db->order_by('sort', 'ASC');
        return $this->db->get();
    }
}